<include file="public@header" />
<style type="text/css">
.maintenance{    list-style-type: none; float:left;width:60%}
.maintenance li{width:50%;float:left;height:30px;line-height:30px}
tr td input,tr td select{  width:auto;}
	.content_nav .check_info{flex:1; display:flex;flex-direction: column;align-items: center;justify-content: center;}
	.form-horizontal .control-group1.group_left{width:50%;}
	.form-horizontal .group_left .control-label{width:90px;}
	.form-horizontal .group_left .controls{margin-left:100px;}
	.form-horizontal .control-group1 {
		float: left;
		width: 15%;
		margin-bottom: 20px;
	}
	.form-horizontal .control-label {width:80px;}
	.form-horizontal .controls {margin-left:90px;}
	input,select, textarea, .uneditable-input {
		max-width: 580px;
		width:100px;
		min-width:auto;
	}
	.form-control{
		width:100%; display:inline-block;
	}

</style>
</head>
<body>
	<php>$page=''</php>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="{:url('Aftersale/maintenance')}">常规维保</a></li>
		</ul>
       <div class="form-horizontal">
            <fieldset>
            <div class="div_title"><span>客户概览</span></div>
            <div class="control-group1-p div_content">
                <div class="col-md-11" style="width:86%;padding-right: 0;">
                    <div class="form-group">
                        <label class="control-label">客户姓名</label>
                        <div class="col-md-2"  style="width: 8%;padding-right:  0;">
                            <input type="text" class="form-control"  value="{$result.buyer_name}" disabled>
                        </div>
                        <label class="control-label" style="width: 60px" >持证类型</label>
                        <div class="col-md-2" style="width: 10%" >
                            <input type="text" class="form-control"  value="{:cart_type('cart',$result.cart_type)}" disabled>
                        </div>
                        <label class="control-label" style="width: 60px" >证件号码</label>
                        <div class="col-md-2" style="width: 17%"  >
                            <input type="text" class="form-control"  value="{$result.customer_account}" disabled>
                        </div>
                        <label class="control-label"  style="width: 60px">联系电话</label>
                        <div class="col-md-2" style="width: 11%;"  >
                            <input type="text" class="form-control"  value="{$result.buyer_phone}" disabled>
                        </div>
                        <label class="control-label" style="width: 60px" >联系地址</label>
                        <div class="col-md-3" style="width: 26%">
                            <input type="text" class="form-control"  value="{$result.customer_address}"  disabled>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label"  >合同编号</label>
                        <div class="col-md-2">
                            <input type="text" class="form-control"  value="{$result.contract_sn}" disabled>
                        </div>
                        <label class="control-label" style="width: 60px">购买日期</label>
                        <div class="col-md-2" style="width: 10%;" >
                            <input type="text" class="form-control" value="{$result.gm_start_time}" disabled>
                        </div>
                        <label class="control-label"style="width: 60px">打证日期</label>
                        <div class="col-md-2" style="width: 11%;"  >
                            <input type="text" class="form-control"  value="{$result.dz_start_time}" disabled>
                        </div>
                        <label class="control-label" style="width: 60px;">保修期止</label>
                        <div class="col-md-2" style="width: 10%;padding-right: 0;"  >
                            <input type="text" class="form-control"  value="{$result.end_bxq_time}" disabled>
                        </div>
                        <label class="control-label" style="width: 30px;">状态</label>
                        <div class="col-md-2"  style="width: 6%;padding-right: 0;" >
                            <input type="text" class="form-control"  value="{$result.bxq_status}" disabled>
                        </div>

                        <label class="control-label" style="width: 60px;">维护期止</label>
                        <div class="col-md-2"  style="width: 11%;padding-right: 0;">
                            <input type="text" class="form-control"  value="{$result.end_whq_time}" disabled>
                        </div>
                        <label class="control-label" style="width: 30px;">状态</label>
                        <div class="col-md-2"  style="width: 7%;" >
                            <input type="text" class="form-control"  value="{$result.whq_status}" disabled>
                        </div>
                    </div>
                <div class="form-group">
                    <label class="control-label">墓位编号</label>
                    <div class="col-md-2">
                        <input type="text" class="form-control" value="{$result.tomb_num}" disabled>
                    </div>
                    <label class="control-label" style="width: 60px">具体位置</label>
                    <div class="col-md-3">
                        <input type="text" class="form-control" value="{$result.tomb_region}{$result.tomb_address}" disabled>
                    </div>
                    <label class="control-label"  style="width: 60px">墓穴规制</label>
                    <div class="col-md-2" style="width: 7%">
                        <input type="text" class="form-control" value="{$result.tomb_regulation_name}" disabled>
                    </div>
                    <label class="control-label" style="width: 60px">当前状态</label>
                    <div class="col-md-2" style="width: 10%">
                        <input type="text" class="form-control" value="{$result.col_status_name}" disabled>
                    </div>
                    <label class="control-label"  style="width: 60px">占地面积</label>
                    <div class="col-md-2" style="width: 9%">
                        <input type="text" class="form-control"  style="width:65px" value=" {$result.footprint}㎡" disabled>
                    </div>
                </div>
                <div class="form-group"  >
                    <label class="control-label">拜道规格</label>
                    <div class="col-md-2">
                        <input type="text" class="form-control"  value="{$result.specifications}mm" disabled>
                    </div>

                    <label class="control-label" style="width: 60px">绿化规格</label>
                    <div class="col-md-2">
                        <input type="text" class="form-control"  value="{$result.green_belt}mm" disabled>
                    </div>
                </div>
                </div>
                <div  class="col-md-1" style="  padding-left: 0;">
                    <img src="{:cmf_get_image_preview_url($result.tom_img)}" style="width:200px; max-width:220px; display:block; margin:0 auto;"/>
                </div>
                <!---tab页-->
                <ul class="nav_tabs">
                    <li data-index="1" class="active"><a href="javascript:">常规维修登记</a></li>
                    <li data-index="2" ><a href="javascript:">石材维修登记</a></li>
                    <li data-index="3" ><a href="javascript:">墓碑换新登记</a></li>
                    <li data-index="4" ><a href="javascript:">历史记录</a></li>
                </ul>
                <div class="control-group1-p nav_content">
                    <div class="content_nav ">
                        <div class="p_title">
                            <span class="span_title">维保项目</span>
                        </div>
                        <form action="{:url('')}" method="post" id="form_conventional">
                            <div class="control-group1-p" style="border:1px solid #e2e2e2; padding-top:20px;margin:0 20px;overflow:hidden; overflow-x:auto;" >
                                <table class="table table-hover table-bordered table-striped" style="width:98%; margin:0 auto;">
                                    <thead>
                                        <tr>
                                            <th  >
                                                <input type="checkbox" style="width: 20px;" class="js-check-all" data-direction="conventional" data-checklist='orderid' />
                                            </th>
                                            <th>项目名称</th>
                                            <th>单位</th>
                                            <th>单价</th>
                                            <th>工期</th>
                                            <th>质保</th>
                                            <th >类型</th>
                                            <th >加急</th>
                                            <th >费用减免</th>
                                            <th >合计</th>
                                            <th >预计交付时间</th>
                                            <th >维修部门</th>
                                            <th >经办人</th>
                                            <th >上次完成时间</th>
                                            <th >备注</th>
                                        </tr>
                                    </thead>
                                    <tbody class="conventional">
                                    <input type="hidden"   name="type"  value="1" />
                                        <foreach name="conventional" item="con">
                                        <tr>
                                            <td class="bs-checkbox ">
                                                <input type="checkbox" style="width:20px" class="js-check" data-direction="y" data-checklist='orderid' name="con[{$key}][part_id]" value="{$con.id}" />
                                            </td>
                                            <td>{$con.name}
                                                <input type="hidden"   name="con[{$key}][part_name]"  value="{$con.name}" />
                                            </td>
                                            <td>{$con.unit}
                                                <input type="hidden"   name="con[{$key}][unit]"  value="{$con.unit}" />
                                            </td>
                                            <td> <label class="warranty" style="font-weight: normal;" >
                                                <!-- <if condition="$con['price'] eq 0">-->免费
                                                <!--<else/>--> {$con.price}
                                                <!--</if>--> </label>

                                                <input type="hidden"   name="con[{$key}][part_price]"  value="{$con.price}" />
                                            </td>
                                            <td>{$con.gq}日
                                                <input type="hidden"   name="con[{$key}][duration]"  value="{$con.gq}" />
                                            </td>
                                            <td>
                                                <label class="warranty" style="font-weight: normal;" >
                                                <!-- <if condition="$con['zb'] eq 0">--> 无
                                                <!--<else/>--> {$con.zb}年
                                                <!--</if>--> </label>
                                                <input type="hidden" class="form-control warranty"  name="con[{$key}][warranty]" value="{$con.zb}"  />
                                            </td>
                                            <td>常规</td>
                                            <td><input type="checkbox"  class="expedited" name="con[{$key}][expedited]" value="1"   /></td>
                                            <td>
                                                <!-- <if condition="$con['price'] eq 0">-->无
                                                <input type="hidden" class="form-control fee_reduction"   name="con[{$key}][fee_reduction]"  />
                                                <!--<else/>-->
                                                <input type="text" class="form-control fee_reduction" style="max-width: 100px;" name="con[{$key}][fee_reduction]"  />
                                                <!--</if>-->
                                                </td>
                                            <td>
                                                <label class="total_price" style="font-weight: normal;" ></label>
                                                <input type="hidden" class="form-control total_price" style="max-width: 115px;" name="con[{$key}][total_price]"  />
                                            </td>
                                            <td><input type="text" class="form-control js-date" style="max-width: 115px;" name="con[{$key}][deliver_time]" value="{$con.deliver_time}"  autocomplete="off"/> </td>
                                            <td>
                                                <select name="con[{$key}][dep_id]" style="max-width: 155px;"  class="form-control">
                                                    <foreach name="userlist" item="vou">
                                                        <if condition=" isset($result['supplier'])">
                                                            <else/>
                                                        </if>
                                                            <option value="{$vou.id}">{$vou.department_name}-{$vou.user_nickname}</option>
                                                    </foreach>
                                                </select>
                                            </td>
                                            <td>{:cmf_get_admin_name()}</td>
                                            <td><a href="javascript:"   class="lookAt"
                                                  data-title="办理人信息" data-url="?t=5&type=1&id={$con.id}">点击查看</a></td>
                                            <td><input type="text" class="form-control " style="min-width: 100px;" name="con[{$key}][remark]"  /></td>
                                        </tr>
                                        </foreach>
                                        <tr>
                                            <td colspan="20"><font color="red" size="+2" id="conventional_total_price_font">合计金额：0 </font>
                                                <input type="hidden" id="conventional_total_price"   name="total_price"  value="0" />
                                                <input type="hidden" class="itype"   name="itype"  value="0" />
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </form>
                      <div class="form-actions">
<!--                            <div class="btn btn-primary" id="check-btn">打印结算单</div>-->
<!--                            <div class="btn btn-primary" id="check-conventional-btn">保存</div>-->
                            <div class="btn btn-primary" id="check-conventional">提交</div>
                        </div>
                    </div>
                    <div class="content_nav feature">
                        <div class="col-lg-12">
                        <!--<if condition="$cate_id eq 2">  -->
                        <select name="mb[pro_id]" class="form-control shicaiweixiu" >
                            <foreach name="tomb_list" item="vo">
                                <option value="{$vo.id}" data-is_bxq_status="{$result.is_bxq_status}" data-part_json='{$vo.pro_part_json}' data-userlistjson='{$userlistjson}' >{$vo.pro_name}</option>
                            </foreach>
                        </select>
                        <!--</if>-->
                    </div>
                        <div class="p_title">
                            <span class="span_title">维保项目</span>
                        </div>

                        <div class="control-group1-p" style="border:1px solid #e2e2e2; padding-top:20px;margin:0 20px;overflow:hidden; overflow-x:auto;">
                        <form action="{:url('')}" method="post" class="form_shicai">
                        <table class="table table-hover table-bordered  table-striped">
                            <thead>
                                <tr>
                                    <th style="width:18px"><input type="checkbox" style="width: 20px;" class="bs-checkbox  js-check-all" data-direction="stone" /></th>
                                    <th style="width:135px">项目名称</th>
                                    <th style="width:45px">单位</th>
                                    <th style="width:80px">单价</th>
                                    <th style="width:73px;">维保数量</th>
                                    <th style="width:100px">处理方式</th>
                                    <th style="width:45px">质保</th>
                                    <th style="width:45px">加急</th>
                                    <th style="width:61px">质保期</th>
                                    <th style="width:73px">质保免费</th>
                                    <th style="width:80px">费用减免</th>
                                    <th style="width:80px">合计</th>
                                    <th style="width:80px">预计交付时间</th>
                                    <th style="width:80px">维修部门</th>
                                    <th style="width:80px">经办人</th>
                                    <th style="width:80px">上次完成时间</th>
                                    <th >备注</th>
                                </tr>
                                <input type="hidden"   name="type"  value="2" />
                            </thead>
                            <tbody class="stone">
                            <foreach name="pro_info" item="info">
                                <tr>
                                    <td width="20">
                                        <input type="checkbox" class="js-check" data-direction="y"  id="part_id"name="part[{$key}][part_id]" value="{$info.id}" />
                                    </td>
                                    <td>{$info.iname}
                                        <input type="hidden"   name="part[{$key}][part_name]"  value="{$info.iname}" />
                                    </td>
                                    <td>件</td>
                                    <td>
                                        <label style="font-weight: normal;" class="part_price">{$info.irepair_price}</label>
                                        <input type="hidden" class="part_price"   name="part[{$key}][part_price]"  value="{$info.irepair_price}" />
                                        <input type="hidden"   name="part[{$key}][unit]"  value="件" /></td>
                                    <td>
                                        <input type="text"  class="form-control duration" style="width: 50px"  name="part[{$key}][duration]"  value="{$info.inumber}" />
                                    </td>
                                    <td>
                                        <select name="part[{$key}][warranty_type]"  style="max-width:  90px "   class="form-control warranty_type">
                                            <option value="1" data-price="{$info.irepair_price}" data-title="维修1年">维修</option>
                                            <option value="3" data-price="{$info.ichange_price}" data-title="更换3年">更换</option>
                                        </select>
                                    </td>
                                    <td>
                                        <label style="font-weight: normal;" class="warranty">1年</label>
                                        <input type="hidden" class="warranty"   name="part[{$key}][warranty]"  value="1" /></td>
                                    </td>
                                    <td>
                                        <input type="checkbox" class="expedited" value="1" name="part[{$key}][expedited]" />
                                    </td>
                                    <td>{$info.is_expired}</td>
                                    <td ><input type="checkbox" class="free_warranty" style="width: 20px;"  name="part[{$key}][free_warranty]"  {$info.is_expired_checked} /></td>
                                    <td><input type="text" class="form-control fee_reduction" style="min-width: 100px;" name="part[{$key}][fee_reduction]"  /></td>
                                    <td>
                                        <label style="font-weight: normal;" class="total_price">0</label>
                                        <input type="hidden" class="total_price"   name="part[{$key}][total_price]"  value="0" />
                                    </td>
                                    <td><input type="text" class="form-control js-date" style="min-width: 110px;" name="part[{$key}][deliver_time]"  autocomplete="off" /> </td>
                                    <td><select name="part[{$key}][dep_id]"  style="min-width: 120px;"  class="form-control">
                                        <foreach name="userlist" item="vou">
                                            <if condition=" isset($result['supplier'])">
                                                <option value="{$vou.id}"  >{$vou.department_name}-{$vou.user_nickname}</option>
                                                <else/>
                                                <option value="{$vou.id}">{$vou.department_name}-{$vou.user_nickname}</option>
                                            </if>
                                        </foreach>
                                    </select></td>
                                    <td>{:cmf_get_admin_name()}</td>
                                    <td><a href="javascript:" class="lookAt" data-title="{$info.iname}"
                                           data-url="?t=5&type=2&id={$info.id}">点击查看</a></td>
                                    <td><input type="text" class="form-control " style="min-width: 100px;" name="part[{$key}][remark]"  /></td>
                                </tr>
                            </foreach>
                                <tr class="stone_tr">
                                    <td colspan="20" id="all_total_price "><font color="red" size="+2" id="stone_total_price_font">合计金额：0 </font>
                                        <input type="hidden" id="stone_total_price"   name="total_price"  value="0" />
                                        <input type="hidden" class="itype"   name="itype"  value="0" />
                                    </td>
                            </tbody>
                        </table>
                        </form>
                      </div>
                      <div class="form-actions">
<!--                            <div class="btn btn-primary" id="check-shicai-btn">保存</div>-->
                            <div class="btn btn-primary" id="check-shicai">提交</div>
                        </div>
                    </div>
                    <div class="content_nav feature">
                        <div class="p_title">
                            <span class="span_title">墓碑换新</span>
                        </div>
                        <div class="control-group1-p" style="border:1px solid #e2e2e2; padding-top:20px;margin:0 20px;overflow:hidden; overflow-x:auto;">
                        <form action="{:url('')}" method="post"  class="form_mb">
                        <table class="table table-hover table-bordered">
                            <thead>
                                <tr>
                                    <th><input type="checkbox" style="width: 20px" class="js-check-all" data-direction="y"  /></th>
                                    <th>项目名称</th>
                                    <th>选择换新产品</th>
                                    <th>单价</th>
                                    <th>数量</th>
                                    <th >费用减免</th>
                                    <th >应收金额</th>
                                    <th >加急</th>
                                    <th >预计交付日期</th>
                                    <th >执行人</th>
                                    <th >经办人</th>
                                    <th >备注</th>
                                </tr>
                            </thead>
                            <tbody id="mb">
                                <tr>
                                    <td width="20">
                                        <input type="checkbox" class="js-check" name="part_id" value="1" />
                                        <input type="hidden"   name="type"  value="3" />
                                    </td>
                                    <td>墓碑换新
                                        <input type="hidden"  name="mb[part_name]"  value="墓碑换新" />
                                    </td>
                                    <td><select name="mb[pro_id]" class="form-control pro_mb" >
                                        <foreach name="tomb_list" item="vo">
                                            <option value="{$vo.id}" data-pro_price="{$vo.pro_price}" data-regulation_name="{$vo.regulation_name}"
                                                    data-length="{$vo.pro_length}" data-address="{$vo.address}" >{$vo.pro_name}</option>
                                        </foreach>
                                    </select></td>
                                    <td>
                                        <label style="font-weight: normal;" class="part_price">0</label>
                                        <input type="hidden" class="part_price"  name="mb[part_price]"  value="{$con.price}" />
                                    </td>
                                    <td><input type="text" class="form-control mb_duration" style="width: 50px" name="mb[duration]" value="1"></td>
                                    <td><input type="text" class="form-control fee_reduction" style="min-width: 100px;" name="mb[fee_reduction]"></td>
                                    <td>
                                        <label style="font-weight: normal;" class="total_price">0</label>
                                        <input type="hidden" class="total_price" name="mb[total_price]" value="0">
                                    </td>
                                    <td><input type="checkbox" class="expedited" value="1" name="mb[expedited]"></td>
                                    <td><input type="text" class="form-control js-date" style="min-width: 115px;" name="mb[deliver_time]"  autocomplete="off" /> </td>
                                    <td><select name="mb[dep_id]"  style="min-width: 120px;"  class="form-control">
                                        <foreach name="userlist" item="vou">
                                            <if condition=" isset($result['dep_id'])">
                                                <option value="{$vou.id}"  >{$vou.department_name}-{$vou.user_nickname}</option>
                                                <else/>
                                                <option value="{$vou.id}">{$vou.department_name}-{$vou.user_nickname}</option>
                                            </if>
                                        </foreach>
                                        </select>
                                    </td>
                                    <td>{:cmf_get_admin_name()}</td>
                                    <td><input type="text" class="form-control " style="min-width: 100px;" name="mb[remark]"  /></td>
                                </tr>
                                <tr>
                                    <td colspan="20" ><font color="red" size="+2" id="mb_total_price_font">合计金额：0 </font>
                                        <input type="hidden" id="mb_total_price"   name="total_price"  value="0" />
                                        <input type="hidden" class="itype"   name="itype"  value="0" />
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                        </form>
                      </div>
                      <div class="form-actions">
<!--                            <div class="btn btn-primary" id="check-mb-btn">保存</div>-->
                            <div class="btn btn-primary" id="check-mb">提交</div>
                        </div>
                    </div>
                     <div class="content_nav feature">
                         <div class="p_title">
                            <span class="span_title">历史记录</span>
                         </div>
                         <div class="control-group1-p" style="border:0px solid #e2e2e2;border-top: 0; padding-top:0px;margin:0 20px;overflow:hidden; overflow-x:auto;">
                             <form action="" method="post">
                                  <table class="table table-hover table-bordered" id="table_records"></table>
                             </form>
                         </div>
                          <div class="form-actions">
                                <div class="btn btn-primary print " data-type="1" id="">补打结算单</div>
                                <div class="btn btn-primary print" data-type="2" id="">补打维修单</div>
                            </div>
                        </div>
                     </div>
                </div>
            </fieldset>
       </div>
        <script type="text/javascript" >
            var index_type = 'index';
            </script>
        <iframe id="printf" src="" width="0" height="0" frameborder="0"></iframe>
        <script type="text/javascript" src="__STATIC__/js/admin.js?v={:time()}"></script>
        <script type="text/javascript" src="__STATIC__/js/init_base.js?v={:time()}"></script>
        <script type="text/javascript" >
            var index_type = 'index';
            $('.print').on('click',function(){
               var idlist = $('#table_records').bootstrapTable('getAllSelections');
               idarr=[];
               for(i = 0; i < idlist.length; i++){
                   idarr.push(idlist[i].id);
               }
               if(idarr.length<1){
                   layer.msg('清选择打印的数据');
                   return;
               }

                var type=$(this).attr('data-type');
                if(type==1){
                    //结算
                    var  mark=8;
                }else{
                    //服务
                    var mark=4;
                }
                $.post("{:url('Stamp/print_cert')}",{'type':mark,'mark':2,'weibao':idarr},function(result){
                    if(result.status==1){
                        var f = document.getElementById('printf');
                        f.contentDocument.write(result.html);
                        f.contentDocument.close();
                        f.contentWindow.print();
                        return false;
                    }
                },'json')
            })
    </div>
</body>
</html>